﻿
(function () {
    appModule.controller('tenant.views.manuscriptstatus.createOrEditManuscriptStatus', [
        '$scope', '$uibModalInstance', 'abp.services.app.manuscriptStatus','manuscriptStatusId',
        function ($scope, $uibModalInstance, manuscriptStatusService,manuscriptStatusId) {
            var vm = this;
            
            vm.saving = false;
            vm.manuscriptStatus = null;
            //提交表单（添加页、修改页）
            vm.save = function () {
                vm.saving = true;
                manuscriptStatusService.createOrUpdateManuscriptStatus({manuscriptStatus:vm.manuscriptStatus}).success(function () {
                    abp.notify.info(app.localize('SavedSuccessfully'));
                    $uibModalInstance.close();
                    vm.curManuscriptStatus = null;
                }).finally(function () {
                    vm.saving = false;
                });
            };
            //关闭弹出页
            vm.cancel = function () {
                $uibModalInstance.dismiss();
            };
            //获取修改行的数据
            function init() {
                manuscriptStatusService.getManuscriptStatusForEdit({
                    id: manuscriptStatusId
                }).success(function (result) {
                    vm.manuscriptStatus = result.manuscriptStatus;
                });
            }
            init();
        }
    ]);
})();
